package com.example.tool.listener;

/**
 * @author: sslong
 * @package: com.funsport.multi.bean
 * @description: ${TODO}{自定义异常类}
 * @date: 2017/8/7 15:58
 */

public class AGException extends Exception {

    protected int errorCode;//错误码
    protected String description;//错误信息提示

    public AGException(int errorCode) {
        this.errorCode = errorCode;
    }

    public AGException(int errorCode, String detailMessage) {
        super(detailMessage);
        this.errorCode = errorCode;
    }

    public AGException(int errorCode, String detailMessage, String description) {
        super(detailMessage);
        this.errorCode = errorCode;
        this.description = description;
    }

    public AGException(int errorCode, Throwable throwable) {
        super(throwable);
        this.errorCode = errorCode;
    }

    public int getErrorCode() {
        return this.errorCode;
    }

    public String getDescription() {
        return this.description;
    }

    public String toString() {
        return this.description == null ? "AGException{errorCode=" + this.errorCode + ", message=\'" + this.getMessage() + '\'' + '}' : "AGException{errorCode=" + this.errorCode + ", message=\'" + this.getMessage() + '\'' + ", description=\'" + this.description + '\'' + '}';
    }

}
